home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / ace102.lha / prgs / sound.b < prev    next >
Text File  |  1993-02-03  |  734b  |  49 lines

  1. '...an example of SOUND & WAVE usage
  2.  
  3. library exec
  4.  
  5. declare function AllocMem& library exec
  6. declare function FreeMem   library exec
  7.  
  8. print
  9. print "white noise:"
  10. print
  11. size&=4000
  12. addr&=AllocMem(size&,clng(2))    '...size& bytes of CHIP RAM
  13.  
  14. print "writing random bytes..."
  15.  
  16. for i&=0 to size&-1
  17.   r%=rnd*128
  18.   s%=rnd*2
  19.   if s%=1 then r%=r%*-1
  20.   poke addr&+i&,r%
  21.   if i& mod 1000 = 0 then print i& 
  22. next    
  23. print
  24.  
  25. wave 0,addr&,size&
  26.  
  27. sound 300,18
  28. for d=1 to 2000:next d  '...pause
  29.  
  30. sound 300,18,,0
  31. for d=1 to 2000:next d  
  32.  
  33. sound 300,18,64
  34. for d=1 to 2000:next d  
  35.  
  36. vol=64
  37. for i%=400 to 200 step -15
  38.  sound i%,4.5,vol,0
  39.  vol=vol-3
  40. next
  41. for i%=200 to 400 step 15
  42.  sound i%,4.5,vol,0
  43.  vol=vol+3
  44. next
  45.  
  46. FreeMem(addr&,size&)
  47.  
  48. library close exec
  49.